﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="testtree.aspx.cs" Inherits="BugSysSolution.JqueryTree.testtree" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="dtree.css" rel="stylesheet" type="text/css" />
    <script src="dtree.js" type="text/javascript"></script>
    <script src="../Javascript/jquery-1.8.0.min.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server">
    <div id="div1" style="width:500px;height:500px;position:absolute;border:1px solid red">
        
    </div>
    <div style="width:100px;height:100px;position:absolute;border:1px solid red;left:520px">
        <input type="button" id="btn1" value="openAll" />
        <input type="button" id="btn2" value="closeAll" />
    </div>
    </form>
</body>
</html>
<script type="text/javascript">
    var d = new dTree("d");
    var d = new dTree('d');
    var obj = [{ id: '0', parentid: '-1', text: '导航栏' }, { id: '1', parentid: '0', text: 'Node 1' }, { id: '2', parentid: '0', text: 'Node 2' }, { id: '3', parentid: '1', text: 'Node 1.1'}];
    for (var i = 0; i < obj.length; i++) {
        d.add(obj[i].id, obj[i].parentid, obj[i].text);
    }

    document.getElementById("div1").innerHTML = d;

    $("#btn1").click(function () {
        d.openAll();
    })

    $("#btn2").click(function () {
        d.closeAll();
    })
</script>